package com.zzc.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Component;

@Component
public class SendMail {

    @Autowired
    JavaMailSenderImpl javaMailSender;

    public void pwdRecovery(String pwd,String toMail){

        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        //主题
        simpleMailMessage.setSubject("养老机构智能监护系统密码重置");
        //内容
        simpleMailMessage.setText("密码重置为"+pwd);
        //接收方
        simpleMailMessage.setTo(toMail);
        //发送方
        simpleMailMessage.setFrom("1910713537@qq.com");

        javaMailSender.send(simpleMailMessage);

    }

}
